package com.zk.cq.constant;


import com.zk.cq.model.bo.BeanMethodBO;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ListenerContext {
    public static Map<String, Map<String, List<BeanMethodBO>>> POST_TYPE_CONTEXT = new ConcurrentHashMap<>();

    static {
        //message
        List<BeanMethodBO> privateMethods = new ArrayList<>();
        List<BeanMethodBO> groupMethods = new ArrayList<>();
        List<BeanMethodBO> discussMethods = new ArrayList<>();
        Map<String,List<BeanMethodBO>> messages = new ConcurrentHashMap<>();
        messages.put(PostTypes.MessageType.PRIVATE,privateMethods);
        messages.put(PostTypes.MessageType.GROUP,groupMethods);
        messages.put(PostTypes.MessageType.DISCUSS,discussMethods);

        //notice
        List<BeanMethodBO> groupUploadMethods = new ArrayList<>();
        List<BeanMethodBO> groupAdminMethods = new ArrayList<>();
        List<BeanMethodBO> groupDecreaseMethods = new ArrayList<>();
        List<BeanMethodBO> groupIncreaseMethods = new ArrayList<>();
        List<BeanMethodBO> friendAddMethods = new ArrayList<>();
        Map<String,List<BeanMethodBO>> notice = new ConcurrentHashMap<>();
        notice.put(PostTypes.NoticeType.GROUP_UPLOAD,groupUploadMethods);
        notice.put(PostTypes.NoticeType.GROUP_ADMIN,groupAdminMethods);
        notice.put(PostTypes.NoticeType.GROUP_DECREASE,groupDecreaseMethods);
        notice.put(PostTypes.NoticeType.GROUP_INCREASE,groupIncreaseMethods);
        notice.put(PostTypes.NoticeType.FRIEND_ADD,friendAddMethods);
        //request_type
        List<BeanMethodBO> addFriendMethods = new ArrayList<>();
        List<BeanMethodBO> addGroupMethods = new ArrayList<>();
        Map<String,List<BeanMethodBO>> requestType = new ConcurrentHashMap<>();
        requestType.put(PostTypes.RequestType.FRIEND,addFriendMethods);
        requestType.put(PostTypes.RequestType.GROUP,addGroupMethods);
        //meta_event_type
        List<BeanMethodBO> lifecycleMethods = new ArrayList<>();
        List<BeanMethodBO> heartbeatMethods = new ArrayList<>();
        Map<String,List<BeanMethodBO>> metaEventType = new ConcurrentHashMap<>();
        metaEventType.put(PostTypes.MetaEventType.LIFECYCLE,lifecycleMethods);
        metaEventType.put(PostTypes.MetaEventType.HEARTBEAT,heartbeatMethods);

        //put
        POST_TYPE_CONTEXT.put(PostTypes.MESSAGE,messages);
        POST_TYPE_CONTEXT.put(PostTypes.NOTICE,notice);
        POST_TYPE_CONTEXT.put(PostTypes.REQUEST,requestType);
        POST_TYPE_CONTEXT.put(PostTypes.META_EVENT,metaEventType);
    }
}
